import 'package:json_annotation/json_annotation.dart';

part 'coupon_model.g.dart';

@JsonSerializable()
class CouponModel extends Object {
  List<CouponItemModel> filter_result;

  Filter filter;

  int total;

  int errcode;

  String message;

  CouponModel(
    this.filter_result,
    this.filter,
    this.total,
    this.errcode,
    this.message,
  );

  factory CouponModel.fromJson(Map<String, dynamic> srcJson) =>
      _$CouponModelFromJson(srcJson);

  Map<String, dynamic> toJson() => _$CouponModelToJson(this);
}

@JsonSerializable()
class CouponItemModel extends Object {
  int? is_receive;

  int? receive_num;

  int? coupon_id;

  String? coupon_name;

  String? status_name;
  String? coupon_money;

  String? coupon_discount;

  String? coupon_desc;

  int? coupon_type;

  int? send_range;

  List<dynamic>? send_range_data;

  String? min_order_amount;

  String? send_start_date;

  String? send_end_date;
  String? start_date;
  String? end_date;

  int? send_type;

  num? use_day;

  String? use_start_date;

  String? use_end_date;

  int? is_show;

  int? is_global;

  int? is_new_user;

  int? enabled_click_get;

  List<dynamic>? limit_user_rank;

  int? shop_id;

  int? is_delete;

  int? limit_num;

  int? delay_day;

  int? send_num;

  String? max_order_amount;

  int? coupon_unit;

  int? reduce_type;

  String? add_time;

  CouponItemModel(
      {this.is_receive,
      this.receive_num,
      this.coupon_id,
      this.coupon_name,
      this.coupon_money,
      this.coupon_discount,
        this.start_date,
        this.end_date,
      this.coupon_desc,
      this.coupon_type,
      this.send_range,
      this.send_range_data,
      this.min_order_amount,
      this.send_start_date,
      this.send_end_date,
      this.send_type,
      this.use_day,
      this.use_start_date,
      this.use_end_date,
      this.is_show,
      this.is_global,
      this.is_new_user,
      this.enabled_click_get,
      this.limit_user_rank,
      this.shop_id,
      this.is_delete,
      this.limit_num,
      this.delay_day,
      this.send_num,
      this.max_order_amount,
      this.coupon_unit,
      this.reduce_type,
      this.add_time,this.status_name});

  factory CouponItemModel.fromJson(Map<String, dynamic> srcJson) =>
      _$CouponItemModelFromJson(srcJson);

  Map<String, dynamic> toJson() => _$CouponItemModelToJson(this);
}

@JsonSerializable()
class Filter extends Object {
  int page;

  int size;

  String? sort_field;

  String? sort_order;

  int? shop_id;

  int? is_show;

  int? valid_date;

  int? receive_date;

  int? receive_flag;

  Filter(
    this.page,
    this.size,
    this.sort_field,
    this.sort_order,
    this.shop_id,
    this.is_show,
    this.valid_date,
    this.receive_date,
    this.receive_flag,
  );

  factory Filter.fromJson(Map<String, dynamic> srcJson) =>
      _$FilterFromJson(srcJson);

  Map<String, dynamic> toJson() => _$FilterToJson(this);
}
